/**
* eCommerce Application Sample for J2EE Training 
* Implementation of AccountBean
* @author Fabienne Boyer - Didier Donsez
* may 2006
*/

package ecom.beans;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity
public class AccountBean implements java.io.Serializable{
    @Id
    private AccountBean AccountBean;
    	int accountId;
    
	//Account owner id
	//int accountOwnerId;
	String emailId;
	
	//Account balance
	double balance;
	
	
	public AccountBean(){
	}

    public AccountBean getAccountBean() {
        return AccountBean;
    }

    public void setAccountBean(AccountBean AccountBean) {
        this.AccountBean = AccountBean;
    }
	public String toString() {
		return emailId + " : " + Double.toString(balance);
}
        
        public boolean withdraw(double amount) {
		if (balance - amount >= 0)
		{
			balance -= amount;
			return true;
		}
		else return false;
	}
	
	public void deposit(double amount) {
		balance += amount;
	}

  // to be completed
}
